<%-- 
    Document   : AdmonPost
    Created on : 30-may-2009, 10:57:08
    Author     : thanent
--%>

<%@page contentType="text/html" pageEncoding="UTF-8" import="Funcionalidad.*,java.util.*,java.net.*" session="true"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
 <jsp:include page="../Apariencia/Cabecera.jsp"/>
<%

        if (session.getAttribute("loginuser") != null) {
            int rol = (Integer) session.getAttribute("loginrol");
            if (rol == 1) {
                URLDecoder deco = new URLDecoder();
%>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

    </head>

    <body>
        <div id="administracion" class="admonPost">
            <h1>Administraci&oacute;n Entradas</h1>
            <%
                List<Post> post = new ArrayList();
                try {
                    post = Posts.consultaPosts();
                } catch (Exception ex) {
                    out.print(ex.getMessage());
                }

            %>
            <table border='0'>

                <%
                Iterator it = post.iterator();
                while (it.hasNext()) {
                    Post pos = (Post) it.next();%>
                <tr><th><a href=AdmonModPost.jsp?id=<%=pos.getId_post()%>>Editar &nbsp;&nbsp;</a></th>
                <td><%=deco.decode(pos.getTitulo(), "ISO-8859-1")%> Publicado en: <%=pos.getFecha()%></td><td><a href=AdmonBorraPost.jsp?id=<%=pos.getId_post()%>>
                <img src="../images/eliminar.png"></a></td><%
                }%>
            </table>
        </div>
    </body>
</html>
<%
            } else {
                response.sendRedirect("../Apariencia/VistaPost.jsp");
            }
        }
%>